import { Injectable } from '@angular/core';
import { loggerService } from './logger.service';

@Injectable()
export class productdataService {
    constructor(public logger:loggerService){}
    //函数用来获取对应的产品的数据,实际业务逻辑下是通过http请求获取服务端的数据
    getProduct():product{
        this.logger.logger('productdataService服务被调用了');
        let objproduct = new product(1,'iphone7',5885,'最新款的苹果手机');
        return objproduct;
    }
}

//声明一个产品的对象
export class product {
    constructor(
        public id:number,
        public title:string,
        public price:number,
        public des:string
    ){

    }
}